package com.cwb.service.impl;

import com.cwb.mapper.AccountMapper;
import com.cwb.pojo.Account;
import com.cwb.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 27435
 * @Date 2025/1/323:51
 * @Version 1.0
 */

@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    /**
     * 根据id查询账户信息
     * @param id
     * @return
     */
    @Override
    public Account getAccountById(Integer id) {
        return accountMapper.selectAccountById(id);
    }

    /**
     * 查询所有账户信息
     * @return
     */
    @Override
    public List<Account> findAll() {
        return accountMapper.selectAll();
    }

    /**
     * 添加账户信息
     * @param account
     * @return
     */
    @Override
    public int addAccount(Account account) {
        return accountMapper.addAccount(account);
    }

    /**
     * 修改账户信息
     * @param account
     * @return
     */
    @Override
    public int updateAccount(Account account) {
        return accountMapper.updateAccount(account);
    }

    /**
     * 根据id删除账户信息
     * @param id
     * @return
     */
    @Override
    public int deleteAccount(Integer id) {
        return accountMapper.deleteAccountById(id);
    }
}
